import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { CustomVO, CustomForm, CustomQuery } from '@/api/system/custom/types';

/**
 * 查询客户信息列表
 * @param query
 * @returns {*}
 */

export const listCustom = (query?: CustomQuery): AxiosPromise<CustomVO[]> => {
  return request({
    url: '/system/custom/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询客户信息详细
 * @param id
 */
export const getCustom = (id: string | number): AxiosPromise<CustomVO> => {
  return request({
    url: '/system/custom/' + id,
    method: 'get'
  });
};

/**
 * 新增客户信息
 * @param data
 */
export const addCustom = (data: CustomForm) => {
  return request({
    url: '/system/custom',
    method: 'post',
    data: data
  });
};

/**
 * 修改客户信息
 * @param data
 */
export const updateCustom = (data: CustomForm) => {
  return request({
    url: '/system/custom',
    method: 'put',
    data: data
  });
};

/**
 * 删除客户信息
 * @param id
 */
export const delCustom = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/custom/' + id,
    method: 'delete'
  });
};
